This page last changed on May 08, 2008 by aperritano.

There are 4 types of collections in OTrunk:

OTResourceList, OTResourceMap, OTObjectList, OTObjectMap

In all cases you should not use a set method in your OTClass. You only add a get method. The list object will be created automatically when it is requested.

An example on how to create an OTResourceList:

  1. Add a sample list to your OTML file:
    <scoreList>
    <string>5</string>
    <string>4</string>
    <string>2</string>
    <string>1</string>
    </scoreList>
    
  1. Add your desired list to your OT interface
	
public OTResourceList getScoreList();
  1. Next update its corresponding controller and process the values as you see fit
    OTResourceList scores = otObject.getScoreList();
    		
    List<Integer> scoresList = new ArrayList<Integer>();
    		
    for (int i = 0; i < scores.size(); i++){
       String s = (String)scores.get(i);
       scoresList.add(new Integer(s));
    }
    	
    realObject.setScores(scoresList); 
     
Document generated by Confluence on Jan 27, 2014 16:52